import { Callout, Card, Cards, Steps, Tabs } from "nextra/components";
import UniversalTabs from "@/components/UniversalTabs";
import { Snippet } from "@/components/code";
import { snippets } from "@/lib/generated/snippets";

# Bulk Run Many Tasks

Often you may want to run a task multiple times with different inputs. There is significant overhead (i.e. network roundtrips) to write the task, so if you're running multiple tasks, it's best to use the bulk run methods.

<UniversalTabs items={["Python", "Typescript", "Go"]}>
  <Tabs.Tab title="Python">

You can use the `aio_run_many` method to bulk run a task. This will return a list of results.

<Snippet src={snippets.python.child.bulk.bulk_run_a_task} />

<Callout type="info">
  `Workflow.create_bulk_run_item` is a typed helper to create the inputs for
  each task.
</Callout>

There are additional bulk methods available on the `Workflow` object.

- `aio_run_many`
- `aio_run_many_no_wait`

And blocking variants:

- `run_many`
- `run_many_no_wait`

As with the run methods, you can call bulk methods from within a task and the runs will be associated with the parent task in the dashboard.

  </Tabs.Tab>
  <Tabs.Tab title="Typescript">

You can use the `run` method directly to bulk run tasks by passing an array of inputs. This will return a list of results.

<Snippet src={snippets.typescript.simple.bulk.bulk_run_a_task} />

There are additional bulk methods available on the `Task` object.

- `run`
- `runNoWait`

As with the run methods, you can call bulk methods on the task fn context parameter within a task and the runs will be associated with the parent task in the dashboard.

<Snippet
  src={snippets.typescript.simple.bulk.bulk_run_tasks_from_within_a_task}
/>

Available bulk methods on the `Context` object are: - `bulkRunChildren` - `bulkRunChildrenNoWait`

  </Tabs.Tab>
  <Tabs.Tab title="Go">

You can use the `RunMany` method directly on the `Workflow` or `StandaloneTask` instance to bulk run tasks by passing an array of inputs. This will return a list of run IDs.

<Snippet src={snippets.go.bulk_operations.main.bulk_run_tasks} />

Additional bulk methods are coming soon for the Go SDK. Join our [Discord](https://hatchet.run/discord) to stay up to date.

  </Tabs.Tab>
</UniversalTabs>
